#pragma once

[["underscore"]]

#include "smart_senser_slice_header.ice"

    module desig
{
    module slice_api
    {
        //客户端接口
        interface Client
        {
            //响应连接服务端
            void OnConnect();

            //响应设备任务id更改
            void OnTaskIdChanged(int wb_id, long task_id);

            //响应系统工作模式
            void OnSystemWorkModes(SystemWorkModeArray modes);

            //------------------------------算法库相关-----------------------------------------------
            //响应检测算法库
            void OnDetectLibrariesInfos(DetectAlgLibraryInfoArray libraries);
            //响应识别算法库
            void OnRecogLibrariesInfos(RecogAlgLibraryInfoArray libraries);
            //响应解调算法库
            void OnDemodLibrariesInfos(DemodAlgLibraryInfoArray libraries);

            //------------------------------系统消息-----------------------------------------------
            //响应消息上报
            void OnMessage(MessageInfoArray infos);
            //响应状态上报
            void OnStates(string key, string value);
            //响应控制模式更改
            void OnControlModeChanged(ControlMode mode);

            //------------------------------系统配置-----------------------------------------------
            //响应系统配置更新
            void OnUpdateSettingInfos(SettingInfoArray infos);

            //------------------------------系统组件-----------------------------------------------
            //响应组件网络信息
            void OnComponentInfo(ComponentInfoArray infos);

            //------------------------------信号列表集合-----------------------------------------------------

            //响应列表组信息删除
            void OnDeleteListGroupInfo(ListType type, StringArray guids);
            //响应列表组信息创建
            void OnCreateListGroupInfo(ListType type, ListGroupInfoArray group_infos);
            //响应列表组信息更新
            void OnUpdateListGroupInfo(ListType type, ListGroupInfoArray group_infos);

            //响应列表信号删除
            void OnDeleteListSignalInfo(ListType type, ListGroupArray groups);
            //响应列表信号创建
            void OnCreateListSignalInfo(ListType type, ListGroupArray groups);
            //响应列表信号更新
            void OnUpdateListSignalInfo(ListType type, ListGroupArray groups);

            //------------------------------波形-----------------------------------------------
            //响应波形删除
            void OnDeletedWaveforms(StringArray ids);
            //响应波形创建
            void OnCreatedWaveforms(WaveformInfoArray waveforms);
            //响应波形更新
            void OnUpdatedWaveforms(WaveformInfoArray waveforms);

            //------------------------------设备相关接口--------------------------------------------------
            //响应设备运行状态
            void OnDeviceRunningStatus(bool status);

            //响应设备连接状态
            void OnDeviceConnectStatus(bool status);

            //响应设备通道启用状态
            void OnDeviceChannelEnablementStatus(int wb_id, bool status);

            //响应设备信息
            void OnDeviceInfos(DeviceInfoArray info);

            //响应设备信息更改
            void OnDeviceSettingsChanged(DeviceSettings setting);

            //响应设备窄带信息更改
            void OnDeviceNarrowbandSettingsChanged(DeviceNarrowbandSettings setting);

            //响应切换设备
            void OnSelectDevice(DeviceInfo info);

            //响应设备工作模式更改
            void OnDeviceWorkModeChanged(int wb_id, DeviceWorkMode mode);

            //响应设备参数更改
            void OnDeviceParamsChanged(int wb_id, FrequnecyInfo info);

            //响应增益更改
            void OnGainChanged(int wb_id, GainControlType type, GainMode mode, float gain);
            // 响应发射增益
            void OnTransmissionGainChanged(int wb_id, float gain);
            //响应数字增益更改
            void OnDigitalGainChanged(int wb_id, float gain);
            //响应电平更改
            void OnLevelChanged(int wb_id, float level);

            //响应变频器更改
            void OnFrequnecyConverterChanged(int wb_id, FreqConverterInfo converter);
            //响应卫星信息更改
            void OnSatelliteInfoChanged(int wb_id, SatelliteInfo info);

            //响应倒谱更改
            void OnInvertSpectrumChanged(int wb_id, bool invert_spectrum);
            //响应设备射频输入通道号更改
            void OnRadioInputChannelChanged(int channel);

            //响应设备回放状态改变
            void OnDevicePlaybackStateChanged(int wb_id, PlaybackStatus status);
            //响应回放循环状态
            void OnDevicePlaybackLoopStateChanged(int wb_id, bool loop);
            //响应设备回放参数改变
            void OnDevicePlaybackParamsChanged(int wb_id, PlaybackInfo info);
            //响应设备回放进度
            void OnDevicePlaybackProgress(int wb_id, PlaybackProgress progress);

            //响应FPGA逻辑加载启动
            void OnFPGALoadStart(string guid);
            //响应FPGA加载进度0~100
            void OnFPGALoadProgress(int progress);
            //响应FPGA加载完成
            void OnFPGALoadComplete(string guid, bool success);

            //响应启动接收设备宽带数据存储
            void OnStartDeviceBroadbandStorage(int wb_id, DataFormat format, DataStorageInfo info);
            //响应停止接收设备宽带数据存储
            void OnStopDeviceBroadbandStorage(int wb_id);
            //响应设备宽带数据存储进度
            void OnDeviceBroadbandStorageProgress(int wb_id, DataStoreProgress progress);
            //响应设备宽带数据存储文件
            void OnDeviceBroadbandStorageFile(int wb_id, string file);

            //响应设备频谱参数改变
            void OnDeviceSpectrumParamsChanged(int wb_id, SpectrumInfo info);
            //响应设备频谱数据输出更改
            void OnDeviceSpectrumOutputChanged(int wb_id, bool enabled);
            //响应启动设备频谱数据存储
            void OnStartDeviceSpectrumStorage(int wb_id, SpectrumStorageInfo info);
            //响应停止设备频谱数据存储
            void OnStopDeviceSpectrumStorage(int wb_id);
            //响应设备频谱数据存储文件
            void OnDeviceSpectrumStorageFile(int wb_id, string file);
            //响应设备频谱数据存储进度
            void OnDeviceSpectrumStorageProgress(int wb_id, DataStoreProgress progress);
            //响应设备显示频谱输出
            void OnDeviceSpectrumOutput(int wb_id, SpectrumPacket packet);

            //响应启动设备频谱分析
            void OnStartDeviceSpectrumAnalyzer(int wb_id);
            //响应停止设备频谱分析
            void OnStopDeviceSpectrumAnalyzer(int wb_id, bool storage_data);
            //响应设置分析缓存时长(单位:秒)
            void OnDeviceSpectrumAnalyzerCacheDuration(int wb_id, int duration);
            //响应设备分析存储数据文件
            void OnDeviceSpectrumAnalyzeStoreFiles(int wb_id, BroadbandFileInfoArray files);

            //---------------------------------频谱信号检测-----------------------------------------------
            //响应频谱检出信号
            void OnSpectrumDetectorSignal(int wb_id, SpectrumSignalInfoArray infos);

            //------------------------------信号检测识别-----------------------------------------------
            //当检测识别停止上报调用此方法
            void OnStartDetectRecog(int wb_id, DetectRecogInfo info);
            //当检测识别停止上报调用此方法
            void OnStopDetectRecog(int wb_id);

            //响应检测识别进度
            void OnDetectRecogProgress(int batch, int signal_index, string guid);
            //响应检测识别信号
            void OnDetectRecogSignals(int wb_id, DetectRecogSignalArray signals);

            //响应检测识别信号状态
            void OnDetectRecogSignalStates(int wb_id, DetectRecogSignalStateArray states);
            //响应检测识别信号样本文件
            void OnDetectRecogSignalSampleFile(int wb_id, string signal_id, string ddc_file, string demod_file, string decode_file);

            //响应创建检测识别信号
            void OnCrateDetectRecogSignal(int wb_id, DetectRecogSignalArray signals);
            //响应移除检测识别信号
            void OnDeleteDetectRecogSignal(int wb_id, StringArray ids);

            //响应检测识别样本采集状态
            void OnDetectRecogSampleStoreStatus(int wb_id, bool enabled);
            //响应检测识别自动控守状态
            void OnDetectRecogAutoCollectStatus(int wb_id, bool collect_known_signal, bool collect_unknown_signal);

            //------------------------------窄带信道化采集处理-----------------------------------------------
            //响应控守信号创建
            void OnCreateCollectSignals(int wb_id, CollectSignalArray signals);
            //响应控守信号删除
            void OnDeleteCollectSignals(int wb_id, StringArray signals);
            //响应控守信号更新
            void OnUpdateCollectSignals(int wb_id, CollectSignalArray signals);

            //响应控守工作状态
            void OnCollectSignalWorkStatus(int wb_id, StringArray ids, bool status);
            //响应控守存储状态
            void OnCollectSignalStoreStatus(int wb_id, StringArray ids, bool status);
            //响应控守分析状态
            void OnCollectSignalAnalysisStatus(int wb_id, StringArray ids, bool status);

            //响应控守信号载噪比
            void OnCollectSignalCarrierNoiseRate(int wb_id, string signal_id, float carrier_noise_rate);

            //响应控守信号存储进度
            void OnCollectSignalStoreProgress(int wb_id, string signal_id, DataStoreProgress progress);
            //响应控守信号存储文件上报
            void OnCollectSignalStoreFile(int wb_id, string signal_id, string file);

            //------------------------------载波分析------------------------------
            //响应分析参数更改
            void OnAnalysisParamsChanged(AnalysisInfo info);

            //响应启动分析
            void OnStartAnalysis();
            //响应停止分析
            void OnStopAnalysis();

            //响应分析频谱参数更改
            void OnAnalysisSpectrumParamsChanged(SpectrumInfo info);

            //响应启动分析数据存储
            void OnStartAnalysisDataStorage(DataStorageInfo info);
            //响应停止分析数据存储
            void OnStopAnalysisDataStorage();

            //响应分析高阶谱测量
            void OnAnalysisMeasure(bool state, AnalysisMeasureResult packet);
            //响应分析识别
            void OnAnalysisRecog(bool state, AnalysisRecogResult packet);
            //响应分析频谱数据输出
            void OnAnalysisSpectrumOutput(AnalysisSpectrumPackets packet);

            //响应分析数据存储进度
            void OnAnalysisDataStorageProgress(DataStoreProgress progress);
            //响应分析数据存储文件
            void OnAnalysisDataStorageFile(string file);

            //------------------------------------------解调------------------------------------------
            //响应启动解调
            void OnStartDemod(DemodInfo info);
            //响应停止解调
            void OnStopDemod();

            //响应解调结果星座输出
            void OnDemodConstelOutput(ConstelPacket packet);
            //响应解调结果符号比特数据输出
            void OnDemodSymbolOutput(SymbolPacket packet);
            //响应解调结果眼图输出
            void OnDemodEyeOutput(EyePacket packet);
            //响应模拟信号解调结果输出
            void OnDemodAnalogOutput(AnalogPacket packet);
            // 响应相位信息
            void OnPhaseInfo(PhaseInfo info);
            // 响应信号质量信息
            void OnSignalQualityInfo(SignalQualityInfo info);

            //响应启动解调存储
            void OnStartDemodResultStorage();
            //响应停止解调存储
            void OnStopDemodResultStorage();

            //响应解调存储进度
            void OnDemodResultStorageProgress(DataStoreProgress progress);
            //响应解调存储文件
            void OnDemodResultStorageFile(string file);

            //------------------------------------------高速解调------------------------------------------
            // 响应解调参数更改
            void OnHighSpeedDemodParamsChange(int channel_id, HighSpeedDemodInfo info);

            // 响应启动
            void OnStartHighSpeedDemod(int channel_id);
            // 响应停止
            void OnStopHighSpeedDemod(int channel_id);

            // 比特图信息
            void OnHighSpeedDemodBitstreamInfo(int channel_id, BitstreamInfo info);
            // 星座图信息
            void OnHighSpeedDemodConstellationDiagramInfo(int channel_id, ConstellationDiagramInfo info);

            // 响应启动解调原始数据存储
            void OnStartHighSpeedDemodRawDataStorage(int channel_id, DataStorageInfo info);
            // 响应停止解调原始数据存储
            void OnStopHighSpeedDemodRawDataStorage(int channel_id);
            // 响应解调原始数据存储文件
            void OnHighSpeedDemodRawDataStorageFile(int channel_id, string file_name);
            // 响应解调原始数据存储进度
            void OnHighSpeedDemodRawDataStorageProgress(int channel_id, DataStoreProgress progress);

            // 响应启动解调结果存储
            void OnStartHighSpeedDemodResultsStorage(int channel_id);
            // 响应停止解调结果存储
            void OnStopHighSpeedDemodResultsStorage(int channel_id);
            // 响应解调结果存储文件
            void OnHighSpeedDemodResultsStorageFile(int channel_id, string file_name);
            // 响应解调结果存储进度
            void OnHighSpeedDemodResultsStorageProgress(int channel_id, DataStoreProgress progress);

            //------------------------------任务列表-----------------------------------------------
            // 创建任务信息
            void OnCreateTaskInfo(TaskInfoArray infos);
            // 更新任务信息
            void OnUpdateTaskInfo(TaskInfoArray infos);
            // 删除任务信息
            void OnDeleteTaskInfo(StringArray guids);
            // 响应任务执行状态
            void OnTaskExecuteStatus(StringArray guids, bool state);
            // 响应任务运行状态
            void OnTaskRunningStatus(string guid, TaskStatus state);
        };

        //服务端接口
        interface Server
        {
            //连接服务端
            void Connect(Client* client);

            //关闭服务端(注：服务端进程关闭)
            void Shutdown();

            //设置任务id(注：设置后服务端所有模块关闭)
            void SetTaskId(int wb_id, long task_id);
            //------------------------------系统配置-----------------------------------------------
            //更新系统配置项
            void UpdateSettingInfos(SettingInfoArray settings);

            //------------------------------信号列表集合-----------------------------------------------
            //列表组信息删除
            void DeleteListGroupInfo(ListType type, StringArray guids);
            //列表组信息创建
            void CreateListGroupInfo(ListType type, ListGroupInfoArray group_infos);
            //列表组信息更新
            void UpdateListGroupInfo(ListType type, ListGroupInfoArray group_infos);

            //列表信号删除
            void DeleteListSignalInfo(ListType type, ListGroupArray groups);
            //列表信号创建
            void CreateListSignalInfo(ListType type, ListGroupArray groups);
            //列表信号更新
            void UpdateListSignalInfo(ListType type, ListGroupArray groups);

            //------------------------------波形-----------------------------------------------
            //删除指定波形集合
            void DeleteWaveforms(StringArray ids);
            //创建指定波形集合
            void CreateWaveforms(WaveformInfoArray waveforms);
            //更新指定波形集合
            void UpdateWaveforms(WaveformInfoArray waveforms);

            //------------------------------数据源---------------------------------------------------------
            //选择设备
            void SelectDevice(DeviceInfo info);

            //设置设备工作模式
            void SetDeviceWorkMode(int wb_id, DeviceWorkMode mode);

            //设置设备射频输入通道号
            void SetRadioInputChannel(int channel);

            //设置接收设备工作参数
            void SetDeviceParams(int wb_id, FrequnecyInfo info);

            // 设置增益
            void SetGain(int wb_id, GainControlType type, GainMode mode, float gain);
            // 设置发射增益
            void SetTransmissionGain(int wb_id, float gain);
            // 设置数字增益
            void SetDigitalGain(int wb_id, float gain);
            // 设置电平
            void SetLevel(int wb_id, float level);

            //设置变频器
            void SetFrequnecyConverter(int wb_id, FreqConverterInfo converter);
            //设置卫星信息
            void SetSatelliteInfo(int wb_id, SatelliteInfo info);
            // 设置倒谱
            void SetInvertSpectrum(int wb_id, bool invert_spectrum);
            //加载FPGA逻辑
            void LoadDeviceFPGA(string guid);

            //设置设备回放循环状态
            void SetDevicePlaybackLoopState(int wb_id, bool loop);
            //设置接收设备回放状态
            void SetDevicePlaybackState(int wb_id, PlaybackStatus status);
            //设置接收设备回放参数
            void SetDevicePlaybackParams(int wb_id, PlaybackInfo info);

            //启动设备宽带数据存储
            void StartDeviceBroadbandStorage(int wb_id, DataFormat type, DataStorageInfo info);
            //停止设备宽带数据存储
            void StopDeviceBroadbandStorage(int wb_id);

            //设置设备显示频谱参数
            void SetDeviceSpectrumParams(int wb_id, SpectrumInfo info);

            //启动设备频谱分析
            void StartDeviceSpectrumAnalyzer(int wb_id);
            //停止设备频谱分析
            void StopDeviceSpectrumAnalyzer(int wb_id, bool storage_data);
            //设置分析缓存时长(单位:秒)
            void SetDeviceSpectrumAnalyzerCacheDuration(int wb_id, int duration);

            //设置设备频谱输出
            void SetDeviceSpectrumOutput(int wb_id, bool enabled);
            //启动设备频谱数据存储
            void StartDeviceSpectrumStorage(int wb_id, SpectrumStorageInfo info);
            //停止设备频谱数据存储
            void StopDeviceSpectrumStorage(int wb_id);

            //------------------------------信号检测识别-----------------------------------------------
            //启动检测服务
            void StartDetectRecog(int wb_id, DetectRecogInfo info);
            //停止检测服务
            void StopDetectRecog(int wb_id);

            //创建检测识别信号
            void CrateDetectRecogSignal(int wb_id, DetectRecogSignalArray signals);
            //移除检测识别信号
            void DeleteDetectRecogSignal(int wb_id, StringArray ids);

            //设置检测识别样本采集状态
            void SetDetectRecogSampleStoreStatus(int wb_id, bool enabled);
            //设置检测识别自动控守状态
            void SetDetectRecogAutoCollectStatus(int wb_id, bool collect_known_signal, bool collect_unknown_signal);

            //------------------------------窄带信道化采集-----------------------------------------------
            //创建控守信号
            void CreateCollectSignals(int wb_id, CollectSignalArray signals);
            //更新控守信号
            void UpdateCollectSignals(int wb_id, CollectSignalArray signals);
            //移除控守信号
            void DeleteCollectSignals(int wb_id, StringArray ids);

            //设置控守信号工作状态
            void SetCollectSignalWorkStatus(int wb_id, StringArray ids, bool status);
            //设置控守信号存储状态
            void SetCollectSignalStoreStatus(int wb_id, StringArray ids, bool status);
            //设置控守分析状态
            void SetCollectSignalAnalysisStatus(int wb_id, StringArray ids, bool status);

            //------------------------------载波分析-----------------------------------------------
            //设置分析参数
            void SetAnalysisParams(AnalysisInfo info);

            //启动分析
            void StartAnalysis();
            //停止分析
            void StopAnalysis();

            //设置频谱计算参数
            void SetAnalysisSpectrumParams(SpectrumInfo info);

            //启动分析数据存储
            void StartAnalysisDataStorage(DataStorageInfo info);
            //停止分析数据存储
            void StopAnalysisDataStorage();

            //载波频谱测量
            void AnalysisSpectrumMeasure(int order);
            //更新测量参数
            void UpdateAnalysisMeasureParams(AnalysisMeasureResult result);
            //载波识别
            void AnalysisRecognition();

            //------------------------------解调-----------------------------------------------
            //启动解调
            void StartDemod(DemodInfo info);
            //停止解调
            void StopDemod();

            //启动解调存储
            void StartDemodResultStorage();
            //停止解调存储
            void StopDemodResultStorage();

            //------------------------------高速解调-----------------------------------------------
            // 设置高速解调参数
            void SetHighSpeedDemodParams(int channel_id, HighSpeedDemodInfo info);

            // 启动高速解调
            void StartHighSpeedDemod(int channel_id);
            // 停止高速解调
            void StopHighSpeedDemod(int channel_id);

            // 启动高速解调原始数据存储
            void StartHighSpeedDemodRawDataStorage(int channel_id, DataStorageInfo info);
            // 停止高速解调原始数据存储
            void StopHighSpeedDemodRawDataStorage(int channel_id);

            // 启动高速解调结果存储
            void StartHighSpeedDemodResultsStorage(int channel_id);
            // 停止高速解调结果存储
            void StopHighSpeedDemodResultsStorage(int channel_id);

            //------------------------------任务列表-----------------------------------------------
            // 创建任务信息
            void CreateTaskInfo(TaskInfoArray infos);
            // 更新任务信息
            void UpdateTaskInfo(TaskInfoArray infos);
            // 删除任务信息
            void DeleteTaskInfo(StringArray guids);
            // 设置任务执行状态
            void SetTaskExecuteStatus(StringArray guids, bool state);
        };
    }
}